--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R04-ModModels-UNODC.log
  log type:  text
 opened on:   5 May 2025, 14:14:23

. 
. //  program:    Stata 
. //  task:       Sample and diagnostics 
. //  project:    Markets  
. 
. version
version 18.5

. clear all

. macro drop _all

. set linesize 80

. set more off

. local tag " 06-06-24| Cleaned 06-06-24"

. local file  "MAR04-ModModels-UNODC"

. local note "|`tag' | `file'"

. local opt "noparen sideway excel noaster  bdec(2)  sdec(2)  pdec(3)   adec(2) 
> e(r2) stats(coef se pval)"

. local dv "lrhom"

. local iv "fraser"

. local iv2 "infantmort" 

. local cont "edu unemp  popdense perurban  sexratio"

. 
. //      #0
. //      loading data 
. use MAR03-MedModel-UNODC.dta, clear 

. 
. //      #1
. //      Moderating Model fraser X infant  
. xtreg lrhom c.`iv'##c.infant `cont', fe vce(cluster CID) 

Fixed-effects (within) regression               Number of obs     =      1,949
Group variable: CID                             Number of groups  =        123

R-squared:                                      Obs per group:
     Within  = 0.2039                                         min =          5
     Between = 0.2568                                         avg =       15.8
     Overall = 0.2515                                         max =         20

                                                F(8, 122)         =      22.07
corr(u_i, Xb) = -0.0932                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 123 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -.2492797   .0718223    -3.47   0.001    -.3914591   -.1071003
  infantmort |  -.0319073   .0138822    -2.30   0.023    -.0593885   -.0044262
             |
    c.fraser#|
c.infantmort |   .0047477   .0022059     2.15   0.033     .0003808    .0091146
             |
         edu |  -1.738914   .5628542    -3.09   0.002     -2.85314   -.6246876
       unemp |   .0048653   .0052747     0.92   0.358    -.0055765    .0153071
    popdense |   -.000314   .0000746    -4.21   0.000    -.0004616   -.0001664
    perurban |  -.0126079   .0107727    -1.17   0.244    -.0339336    .0087178
    sexratio |  -.0151423   .0045884    -3.30   0.001    -.0242255    -.006059
       _cons |   6.531238   .8493139     7.69   0.000     4.849936     8.21254
-------------+----------------------------------------------------------------
     sigma_u |  1.0578228
     sigma_e |  .28408928
         rho |  .93272735   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', replace `opt'  ctitle(Fraser X infant)
MAR04-ModModels-UNODC.xml
dir : seeout

. //      #2
. //      Moderating hertiage X infant 
. xtreg lrhom c.heritage##c.infant `cont', fe vce(cluster CID) 

Fixed-effects (within) regression               Number of obs     =      1,878
Group variable: CID                             Number of groups  =        120

R-squared:                                      Obs per group:
     Within  = 0.2129                                         min =          2
     Between = 0.2629                                         avg =       15.7
     Overall = 0.2586                                         max =         20

                                                F(8, 119)         =      32.91
corr(u_i, Xb) = -0.1175                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 120 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
    heritage |   -.025725   .0053098    -4.84   0.000    -.0362389    -.015211
  infantmort |   -.029216   .0091402    -3.20   0.002    -.0473146   -.0111175
             |
  c.heritage#|
c.infantmort |    .000518   .0001788     2.90   0.004      .000164     .000872
             |
         edu |  -1.759992   .5552121    -3.17   0.002    -2.859367   -.6606163
       unemp |    .003924   .0052977     0.74   0.460    -.0065659    .0144139
    popdense |  -.0003406   .0000646    -5.27   0.000    -.0004686   -.0002126
    perurban |  -.0117138   .0100887    -1.16   0.248    -.0316903    .0082628
    sexratio |  -.0150779   .0039158    -3.85   0.000    -.0228316   -.0073242
       _cons |   6.365505   .6465802     9.84   0.000     5.085212    7.645798
-------------+----------------------------------------------------------------
     sigma_u |  1.0673539
     sigma_e |  .28444154
         rho |  .93369102   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(hertiage X infant)
MAR04-ModModels-UNODC.xml
dir : seeout

. //      #3
. //      Moderating ROL X infant 
. xtreg lrhom c.rol##c.infant `cont', fe vce(cluster CID) 

Fixed-effects (within) regression               Number of obs     =      1,789
Group variable: CID                             Number of groups  =        123

R-squared:                                      Obs per group:
     Within  = 0.2260                                         min =          5
     Between = 0.3320                                         avg =       14.5
     Overall = 0.3232                                         max =         18

                                                F(8, 122)         =      52.16
corr(u_i, Xb) = -0.3128                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 123 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         rol |  -.5982435   .1080492    -5.54   0.000    -.8121377   -.3843492
  infantmort |  -.0007021   .0056402    -0.12   0.901    -.0118675    .0104633
             |
       c.rol#|
c.infantmort |   .0092075    .004643     1.98   0.050     .0000162    .0183987
             |
         edu |  -2.270845   .5376698    -4.22   0.000    -3.335216   -1.206474
       unemp |   .0034158   .0045534     0.75   0.455    -.0055981    .0124297
    popdense |  -.0001895    .000056    -3.39   0.001    -.0003003   -.0000787
    perurban |  -.0170088   .0104816    -1.62   0.107    -.0377581    .0037405
    sexratio |  -.0129297   .0033181    -3.90   0.000    -.0194982   -.0063612
       _cons |   5.360059   .6450951     8.31   0.000     4.083029    6.637089
-------------+----------------------------------------------------------------
     sigma_u |   1.075775
     sigma_e |   .2696328
         rho |  .94089251   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(rol X infant)
MAR04-ModModels-UNODC.xml
dir : seeout

. 
. //      #4
. //      GDP set up 
. * qladder gdp 
. gen lgdp=log(gdp)
(18 missing values generated)

. label var lgdp "Ln GDP per capita"

. 
. //      #5
. //      Moderating GDP 
. xtreg `dv' c.fraser##c.lgdp `iv2' `cont', fe vce(cluster CID)

Fixed-effects (within) regression               Number of obs     =      1,931
Group variable: CID                             Number of groups  =        122

R-squared:                                      Obs per group:
     Within  = 0.2111                                         min =          5
     Between = 0.2594                                         avg =       15.8
     Overall = 0.2544                                         max =         20

                                                F(9, 121)         =      19.84
corr(u_i, Xb) = -0.3440                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 122 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |   .3628568   .5025655     0.72   0.472    -.6321042    1.357818
        lgdp |   -.085799   .4623385    -0.19   0.853     -1.00112     .829522
             |
    c.fraser#|
      c.lgdp |  -.0501815   .0569379    -0.88   0.380     -.162905     .062542
             |
  infantmort |  -.0068061   .0053748    -1.27   0.208     -.017447    .0038348
         edu |  -1.421882   .6508714    -2.18   0.031    -2.710454   -.1333107
       unemp |   .0006792   .0052739     0.13   0.898    -.0097618    .0111203
    popdense |  -.0002328   .0000777    -3.00   0.003    -.0003866   -.0000791
    perurban |  -.0096251   .0109585    -0.88   0.382    -.0313203    .0120701
    sexratio |  -.0169824   .0051323    -3.31   0.001    -.0271432   -.0068217
       _cons |   6.088245   4.002982     1.52   0.131    -1.836714     14.0132
-------------+----------------------------------------------------------------
     sigma_u |  1.1379769
     sigma_e |  .28376246
         rho |    .941461   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(faser X lgdp)
MAR04-ModModels-UNODC.xml
dir : seeout

. 
. xtreg `dv' c.heritage##c.lgdp `iv2' `cont', fe vce(cluster CID)

Fixed-effects (within) regression               Number of obs     =      1,860
Group variable: CID                             Number of groups  =        119

R-squared:                                      Obs per group:
     Within  = 0.2355                                         min =          2
     Between = 0.2686                                         avg =       15.6
     Overall = 0.2669                                         max =         20

                                                F(9, 118)         =      25.75
corr(u_i, Xb) = -0.4270                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 119 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
    heritage |   .0451786    .024852     1.82   0.072    -.0040351    .0943922
        lgdp |  -.1798059   .2695628    -0.67   0.506    -.7136135    .3540018
             |
  c.heritage#|
      c.lgdp |  -.0062619   .0027831    -2.25   0.026    -.0117732   -.0007506
             |
  infantmort |  -.0052021   .0048513    -1.07   0.286     -.014809    .0044047
         edu |  -1.160096   .6363516    -1.82   0.071    -2.420246    .1000531
       unemp |  -.0033558   .0052458    -0.64   0.524     -.013744    .0070324
    popdense |  -.0002258   .0000748    -3.02   0.003     -.000374   -.0000777
    perurban |  -.0059632   .0104223    -0.57   0.568    -.0266022    .0146759
    sexratio |  -.0185256    .004817    -3.85   0.000    -.0280646   -.0089865
       _cons |   6.823793     2.3694     2.88   0.005     2.131736    11.51585
-------------+----------------------------------------------------------------
     sigma_u |  1.2043782
     sigma_e |  .28131609
         rho |  .94826402   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(heritage X lgdp)
MAR04-ModModels-UNODC.xml
dir : seeout

. 
. xtreg `dv' c.rol##c.lgdp `iv2' `cont', fe vce(cluster CID)

Fixed-effects (within) regression               Number of obs     =      1,773
Group variable: CID                             Number of groups  =        122

R-squared:                                      Obs per group:
     Within  = 0.2329                                         min =          5
     Between = 0.3048                                         avg =       14.5
     Overall = 0.2949                                         max =         18

                                                F(9, 121)         =      31.49
corr(u_i, Xb) = -0.5013                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 122 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         rol |   .7513197   .7809151     0.96   0.338    -.7947077    2.297347
        lgdp |  -.3375154   .2032493    -1.66   0.099     -.739901    .0648703
             |
c.rol#c.lgdp |  -.1260301   .0837662    -1.50   0.135    -.2918674    .0398071
             |
  infantmort |  -.0091047   .0040591    -2.24   0.027    -.0171408   -.0010687
         edu |  -1.993529   .6358492    -3.14   0.002     -3.25236   -.7346978
       unemp |  -.0010325   .0048689    -0.21   0.832    -.0106719    .0086068
    popdense |  -.0000939   .0000757    -1.24   0.217    -.0002439     .000056
    perurban |  -.0136649   .0108035    -1.26   0.208    -.0350532    .0077234
    sexratio |  -.0150749   .0038288    -3.94   0.000    -.0226549   -.0074949
       _cons |   8.379025   1.680754     4.99   0.000     5.051529    11.70652
-------------+----------------------------------------------------------------
     sigma_u |  1.2083518
     sigma_e |  .26943154
         rho |  .95263717   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(rol X lgdp)
MAR04-ModModels-UNODC.xml
dir : seeout

. 
. //      #6
. //      INfant and GDP mods together
. xtreg `dv' c.fraser##c.lgdp c.fraser##c.`iv2' `cont', fe vce(cluster CID)
note: fraser omitted because of collinearity.

Fixed-effects (within) regression               Number of obs     =      1,931
Group variable: CID                             Number of groups  =        122

R-squared:                                      Obs per group:
     Within  = 0.2166                                         min =          5
     Between = 0.2599                                         avg =       15.8
     Overall = 0.2566                                         max =         20

                                                F(10, 121)        =      20.48
corr(u_i, Xb) = -0.2835                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 122 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -.4638929   .6469815    -0.72   0.475    -1.744763    .8169776
        lgdp |  -.5771504   .5256238    -1.10   0.274    -1.617761    .4634606
             |
    c.fraser#|
      c.lgdp |   .0310232   .0692866     0.45   0.655     -.106148    .1681943
             |
      fraser |          0  (omitted)
  infantmort |  -.0408226   .0224599    -1.82   0.072     -.085288    .0036428
             |
    c.fraser#|
c.infantmort |   .0054994   .0032479     1.69   0.093    -.0009306    .0119295
             |
         edu |  -1.403982   .6504312    -2.16   0.033    -2.691682   -.1162823
       unemp |   .0013608    .005296     0.26   0.798     -.009124    .0118457
    popdense |   -.000285   .0000763    -3.74   0.000     -.000436   -.0001339
    perurban |  -.0081585   .0107242    -0.76   0.448      -.02939    .0130729
    sexratio |  -.0168175   .0051175    -3.29   0.001    -.0269489    -.006686
       _cons |    10.9775   4.757465     2.31   0.023     1.558844    20.39616
-------------+----------------------------------------------------------------
     sigma_u |  1.1069793
     sigma_e |  .28284206
         rho |  .93871651   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(fraser X lgdp fraserX`iv2')
MAR04-ModModels-UNODC.xml
dir : seeout

. qui reg `dv' c.fraser##c.lgdp c.fraser##c.`iv2' `cont', vce(cluster CID)

. vif

    Variable |       VIF       1/VIF  
-------------+----------------------
      fraser |    182.63    0.005475
        lgdp |    238.82    0.004187
    c.fraser#|
      c.lgdp |    617.98    0.001618
  infantmort |    186.51    0.005362
    c.fraser#|
c.infantmort |    160.51    0.006230
         edu |      5.59    0.178949
       unemp |      1.18    0.846461
    popdense |      1.18    0.847812
    perurban |      2.62    0.382084
    sexratio |      1.28    0.780403
-------------+----------------------
    Mean VIF |    139.83

. 
. xtreg `dv' c.heritage##c.lgdp c.heritage##c.`iv2' `cont', fe vce(cluster CID)
note: heritage omitted because of collinearity.

Fixed-effects (within) regression               Number of obs     =      1,860
Group variable: CID                             Number of groups  =        119

R-squared:                                      Obs per group:
     Within  = 0.2362                                         min =          2
     Between = 0.2716                                         avg =       15.6
     Overall = 0.2702                                         max =         20

                                                F(10, 118)        =      24.34
corr(u_i, Xb) = -0.4157                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 119 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
    heritage |   .0220699   .0407894     0.54   0.589    -.0587042     .102844
        lgdp |  -.2994977   .3171596    -0.94   0.347      -.92756    .3285645
             |
  c.heritage#|
      c.lgdp |  -.0041144   .0041432    -0.99   0.323    -.0123191    .0040903
             |
    heritage |          0  (omitted)
  infantmort |  -.0175977   .0141338    -1.25   0.216    -.0455865     .010391
             |
  c.heritage#|
c.infantmort |   .0002231   .0002618     0.85   0.396    -.0002952    .0007415
             |
         edu |  -1.136396   .6370213    -1.78   0.077    -2.397872    .1250793
       unemp |  -.0036543   .0052017    -0.70   0.484    -.0139551    .0066464
    popdense |  -.0002428   .0000736    -3.30   0.001    -.0003886   -.0000971
    perurban |  -.0055808   .0105101    -0.53   0.596    -.0263937    .0152321
    sexratio |  -.0184034   .0048566    -3.79   0.000    -.0280208   -.0087859
       _cons |    8.06455    2.86202     2.82   0.006      2.39697    13.73213
-------------+----------------------------------------------------------------
     sigma_u |  1.1928762
     sigma_e |   .2812691
         rho |    .947331   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' ctitle(heritage X lgdp heritage`iv2')
MAR04-ModModels-UNODC.xml
dir : seeout

. 
. qui reg `dv' c.heritage##c.lgdp c.heritage##c.`iv2' `cont', vce(cluster CID)

. vif 

    Variable |       VIF       1/VIF  
-------------+----------------------
    heritage |    160.76    0.006220
        lgdp |    139.35    0.007176
  c.heritage#|
      c.lgdp |    453.93    0.002203
  infantmort |    135.96    0.007355
  c.heritage#|
c.infantmort |    125.50    0.007968
         edu |      5.65    0.177117
       unemp |      1.23    0.814596
    popdense |      1.27    0.785770
    perurban |      2.57    0.389834
    sexratio |      1.25    0.798112
-------------+----------------------
    Mean VIF |    102.75

. 
. xtreg `dv' c.rol##c.lgdp c.rol##c.`iv2' `cont', fe vce(cluster CID)
note: rol omitted because of collinearity.

Fixed-effects (within) regression               Number of obs     =      1,773
Group variable: CID                             Number of groups  =        122

R-squared:                                      Obs per group:
     Within  = 0.2346                                         min =          5
     Between = 0.3136                                         avg =       14.5
     Overall = 0.3039                                         max =         18

                                                F(10, 121)        =      32.71
corr(u_i, Xb) = -0.4857                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 122 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         rol |   .2196067    .752326     0.29   0.771    -1.269821    1.709034
        lgdp |  -.3068907   .2084261    -1.47   0.144    -.7195251    .1057437
             |
c.rol#c.lgdp |  -.0767985   .0770373    -1.00   0.321    -.2293142    .0757171
             |
         rol |          0  (omitted)
  infantmort |  -.0056793   .0060759    -0.93   0.352     -.017708    .0063495
             |
       c.rol#|
c.infantmort |   .0049801     .00505     0.99   0.326    -.0050176    .0149779
             |
         edu |  -1.956944   .6334032    -3.09   0.002    -3.210933   -.7029556
       unemp |  -.0006088   .0049336    -0.12   0.902    -.0103762    .0091585
    popdense |  -.0001197   .0000741    -1.62   0.109    -.0002664    .0000269
    perurban |   -.013303   .0107028    -1.24   0.216     -.034492    .0078861
    sexratio |  -.0148895   .0038273    -3.89   0.000    -.0224667   -.0073124
       _cons |   7.980435   1.780053     4.48   0.000      4.45635    11.50452
-------------+----------------------------------------------------------------
     sigma_u |  1.1869436
     sigma_e |  .26922012
         rho |  .95107084   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', append `opt' title(rol X lgdp rol`iv2')
MAR04-ModModels-UNODC.xml
dir : seeout

. qui reg `dv' c.rol##c.lgdp c.rol##c.`iv2' `cont', vce(cluster CID)

. vif 

    Variable |       VIF       1/VIF  
-------------+----------------------
         rol |    249.91    0.004001
        lgdp |      9.20    0.108678
c.rol#c.lgdp |    213.70    0.004680
  infantmort |      6.74    0.148263
       c.rol#|
c.infantmort |      7.92    0.126193
         edu |      5.82    0.171793
       unemp |      1.21    0.827730
    popdense |      1.09    0.915230
    perurban |      2.67    0.374661
    sexratio |      1.30    0.771522
-------------+----------------------
    Mean VIF |     49.96

. 
. //      #7
. //      save and close
. note:  Moderating models | `note'.

. notes

_dta:
  1.  Cleaned WHO homicide data for overall, age and gender | merged data
      together | |meg | 03-23-2023 | CT01-DataMerge-V02.
  2.  30JUN2022
  3.  Got data out of .csv into .dta, merged data, and generated variables | \
      06-28-2022 \ SP01-CleaningData.
  4.  Completed sample and pre-model diagnostics | | 05-05-25 |
      MAR02-SampDiag-UNODC.
  5.  Hertiage heritage -> infant unable to find maximum | | 07-05-23| Cleaned
      06-06-24 | MAR03-MedModel-UNODC.
  6.  Mediation models | | 07-05-23| Cleaned 06-06-24 | MAR03-MedModel-UNODC.
  7.  Moderating models | | 06-06-24| Cleaned 06-06-24 | MAR04-ModModels-UNODC.

ryoung:
  1.  (pop1519*1000)+(pop2024*1000)/pop *100

rmyoung:
  1.  (mpop1519*1000)+(mpop2024*1000)+(mpop2529*1000)/popmale*100 | \ 06-28-2022
      \ SP01-CleaningData.

edu:
  1.  (eys_index+mys_index)/2 | \ 06-28-2022 \ SP01-CleaningData.

unemp:
  1.  Nation Estimates then missing filled with ILO estimates corr 1 or .9457 |
      \ 06-28-2022 \ SP01-CleaningData.

sexratio:
  1.  popmale/popfemale*100 | \ 06-28-2022 \ SP01-CleaningData.

eys_index:
  1.  (eys-0)/(18+0) | \ 06-28-2022 \ SP01-CleaningData

mys_index:
  1.  (mys-0)/(15+0) | \ 06-28-2022 \ SP01-CleaningData

lrhom_un:
  1.  | 05-05-25 | MAR02-SampDiag-UNODC.

. save `file'.dta, replace 
(file MAR04-ModModels-UNODC.dta not found)
file MAR04-ModModels-UNODC.dta saved

. log close 
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R04-ModModels-UNODC.log
  log type:  text
 closed on:   5 May 2025, 14:15:18
--------------------------------------------------------------------------------
